<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>长按识别二维码</title>
    <load href="/Public/lib/js/jq.js"/>
</head>
<body>
<div style="width:80%;overflow:hidden;margin:20% auto;">
<img id="img" src="{$data.img}" width="100%" height="100%"/>
</div>

<script src="https://res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=OSsEefLZTZcaQDAQMDGx3WVjd93bKrsf"></script>
<script type="text/javascript">
    $(function (){
        var u = navigator.userAgent;
        var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
        var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
        if(isAndroid){
            phone(2);
        }else if(isiOS){
            phone(1);
        }
        function phone(key) {
            $.post('index',{key:key,id:'{$data.id}'})
        }
    });
   
		$("#img").on({  
            touchstart: function(e) { 
                // 长按事件触发  
                timeOutEvent = setTimeout(function() {  
                    timeOutEvent = 0;  
                    $.post('index',{code:true,id:'{$data.id}'})
                }, 1000);  
                //长按1秒   
            }
        }) 
</script>
</body>
</html>